<?php

class User_Form_Admin_Setting_Signup extends Form
{

	function init()
	{
		$this -> addChild('yesno', 'require_invitation', array(
			'label' => 'Require Invitation',
			'required' => true,
			'rules' => 'required',
			'value' => '1'
		));

		$this -> addChild('yesno', 'require_username', array(
			'label' => 'Require username',
			'required' => true,
			'rules' => 'required',
			'value' => '1'
		));

		$this -> addChild('yesno', 'require_password', array(
			'label' => 'Require password',
			'required' => true,
			'rules' => 'required',
			'value' => '1'
		));

		$this -> addChild('yesno', 'verify_email', array(
			'label' => 'Verify email',
			'required' => true,
			'rules' => 'required',
			'value' => '1'
		));

		$this -> addChild('yesno', 'welcome_email', array(
			'label' => 'Send welcome email',
			'required' => true,
			'rules' => 'required',
			'value' => '1'
		));

		$this -> addChild('radio', 'require_captcha', array(
			'label' => 'Require Captcha',
			'required' => true,
			'rules' => 'required',
			'multiOptions' => array(
				'0' => 'No',
				'1' => 'Yes',
				'2' => 'Auto detect by plugin'
			),
			'value' => '2'
		));

		$this -> addChild('yesno', 'auto_approval', array(
			'label' => 'Auto approval',
			'required' => true,
			'rules' => 'required',
			'value' => '1'
		));

		$this -> addChild('yesno', 'auto_active', array(
			'label' => 'Auto active',
			'required' => true,
			'rules' => 'required',
			'value' => '1'
		));

		$this -> addChild('select', 'default_role', array(
			'label' => 'Default Role',
			'required' => true,
			'rules' => 'required',
			'multiOptions' => Model::getTable('user/role') -> getMultiOptions(),
		));

		$this -> addChild('textarea', 'allow_domain', array(
			'label' => 'Allow mail domain',
			'desc' => 'user.admin.signup.allow_domain.desc',
		));

		$this -> addChild('text', 'redirect_url', array(
			'label' => 'Redirect',
			'required' => true,
			'value' => '/'
		));

		$this -> addChild('group', 'buttons');

		$this -> buttons -> addChild('submit', '_submit') -> addChild('cancel', '_cancel');
	}

}
